package com.distribute.rest.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.distribute.rest.service.RedisService;
import com.distribute.common.pojo.DistributeResult;

/**
 * 缓存同步Controller
 * @version 1.0
 */
@Controller

@RequestMapping("/cache/sync")
public class RedisController {

	@Autowired
	private RedisService redisService;
	
	@RequestMapping("/content/{contentCid}")
	@ResponseBody
	public DistributeResult contentCacheSync(@PathVariable Long contentCid) {
		DistributeResult result = redisService.syncContent(contentCid);
		return result;
	}
	
	@RequestMapping("/itemBaseInfo/{itemId}")
	@ResponseBody
	public DistributeResult itemBaseInfoCacheSync(@PathVariable Long itemId) {
		DistributeResult result = redisService.syncItemBaseInfo(itemId);
		return result;
	}
	
	@RequestMapping("/itemDesc/{itemId}")
	@ResponseBody
	public DistributeResult itemDescCacheSync(@PathVariable Long itemId) {
		DistributeResult result = redisService.syncItemDesc(itemId);
		return result;
	}
}
